#include <pthread.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>

#define THREADNUM 5

void* StartFun(void* arg){
    printf("i am thread:[%d]\n", *(int*)arg);
    printf("my tid is: [%lX]\n", pthread_self());
    sleep(10);
  return NULL;
}

int main(){
  pthread_t tid;
  int ret;
  for(int i = 0; i < THREADNUM; ++i){
    if((ret = pthread_create(&tid, NULL, StartFun, &i)) != 0){
      fprintf(stderr, "pthread_create: %s\n", strerror(ret));
      exit(0);
    }
    printf("thread create success tid = [%lx]\n", tid);
  }
    printf("i am main pid = [%lx]\n", pthread_self());
    sleep(10);
  return 0;
}
